package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {
    /*
    *
    * 向口味表中批量插入数据
    *
    * */
    void insertFlavor(List<DishFlavor> flavors);


    /*
    *
    * 根据dish_id批量删除数据
    *
    * */
    void deleteByIds(List<Long> ids);

    @Select("select * from dish_flavor where dish_id = #{id}")
    List<DishFlavor> getById(Long id);

    /*
    *
    * 根据id删除数据(用于修改)
    *
    * */
    @Delete("delete from dish_flavor where dish_id = #{id}")
    void deleteById(Long id);

    /**
     *
     * 根据菜品id查询口味
     * @param id
     * */
    @Select("select * from dish_flavor where dish_id =#{id}")
    List<DishFlavor> getByDishId(Long id);
}
